//
//  SendFoodViewModel.swift
//  SmartHousekeeper
//
//  Created by 刘森 on 2020/2/20.
//  Copyright © 2020 LS. All rights reserved.
//

import Foundation
import UIKit

extension SendFoodViewController {
    func initWithSubscribeSignal() {
        
        self.naviRightItem.sce.add(.touchUpInside) { (button) in
            print("naviRightItem")
        }
        self.topView.cityButton.sce.add(.touchUpInside) { (button) in
            print(button.titleLabel?.text ?? "")
        }
        
        self.segmentBar.touch = { [weak self] index in
            self?.bodyView.firstLevelData = dataArr.shuffled()
            self?.bodyView.secondLevelData = dataArr1.shuffled()
            
        }
        
        self.bodyView.firstLevelTableViewCellTouch = { [weak self]  indexPath in
            self?.bodyView.secondLevelData = dataArr1.shuffled()
        }
        
        self.bodyView.secondLevelTableViewCellTouch = { [weak self] indexPath in
            let vc = FreshFoodDetailViewController()
            vc.model = dataArr1[indexPath.row, true]
            self?.navigationController?.pushViewController(vc, animated: true)
        }
        
        self.bottomView.shopBagButton.sce.add(.touchUpInside) { (button) in
            var arr = [FreshFoodBaseCellModel]()
            dataArr1.forEach{ arr.append($0) }
            arr.append(FreshFoodShopPostageModel(postageName: "快递费+打包费", price: "6.8"))
            
            FreshFoodShopBagView.show(models: arr)
        }
        
        //立即支付
        self.bottomView.paymentButton.sce.add(.touchUpInside) { (button) in
            print("立即支付")
        }
        
        
        
    }
    
    
}
